function submitCode(obj) {
	if(UTIL.checkButton(obj)) {
		if(check()) {
			var disable = $("#disable").val();
			var id = $("#id").val();
			var categoryName = $("#categoryName").val();
			var detailModifyName = $("#detailModifyName").val();

			
			API.icdDiseaseNationalStdSumitEdit({ 'disable':disable,'categoryName':categoryName,'id':id,'detailModifyName':detailModifyName }, function(res) {
				UTIL.releaseButton(obj);
				if (res.code == '0') {
					window.location.href = "disease_national_std_list.htm" ;
					return true;
				} else {
						alert(res.desc);
				}
			});
		}
		UTIL.releaseButton(obj);
		return false;
	}
}

function check() {
	var msg = "";
	
	
	var disable = $("#disable").val();
	
	var category = $("#categoryName").val();
	var detailCode = $("#detailCode").val();
	var detailAccessoryCode = $("#detailAccessoryCode").val();
	if(!detailCode && detailAccessoryCode && (category || disable)){
		msg += "只有附属码一级和disable必须为空！\n"; 
	}else if((!category && (disable == '0' || disable == '1')) && detailCode) {
		msg += "一级不能为空！\n";
	}
	
	if(msg) {
		alert(msg);
		return false;
	}
	return true;
}


// 新增编码时根据编码联动带出类目和亚目
function changeCode() {
	var code = $("#code").val();
	if(code.length >= 3) {
		API.icdCodeGetPnameByCode({"code" : code}, function(res) {
			if (res.code == '0') {
				var pName = res.data.pName;
				var gpName = res.data.gpName;
				$("#gpName").html(gpName);
				$("#pName").html(pName);
				return true;
			} else {
				alert(res.desc);
			}
		});
	} else {
		return true;
	}
	return false;
}
